package com.vitabuybuy.tv.ui.home.adapter

import androidx.recyclerview.widget.RecyclerView
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ItemListLiveBinding
import com.vitabuybuy.tv.dto.LiveListDto
import com.library.common.base.BindRecycAdapter
import com.library.common.ext.logE
import com.vitabuybuy.tv.inter.OnItemLiveClickListener

class LiveAdapter : BindRecycAdapter<ItemListLiveBinding, LiveListDto>() {
    override fun onBindViewHolder(
        mBinding: ItemListLiveBinding,
        itemData: LiveListDto,
        holder: RecyclerView.ViewHolder,
        position: Int
    ) {
        mBinding.itemBean = itemData
        mBinding.position = position
        mBinding.listenner = object : OnItemLiveClickListener {
            override fun onItemClick(item: LiveListDto, position: Int) {
                onItemCLickListener.invoke(item)
            }
        }
    }

    override fun normalViewId(viewType: Int): Int {
        return R.layout.item_list_live
    }

    lateinit var onItemCLickListener: (item: LiveListDto) -> Unit

}
